<template>
	<view class="content">
		<view class="title">{{curStory.title}}</view>
		<view class="mian">{{curStory.mian}}</view>
		<view class="reveal-btn" @click="reveal" >{{revealed?'隐藏汤底':'揭示汤底'}}</view>
		<view class="di" v-show="revealed">{{curStory.di}}</view>
	</view>
</template>

<script>
	import storys from '@/static/storys.json'
	export default {
		data() {
			return {
				storys,
				id:1,
				revealed:false, //是否揭示
			}
		},
		onLoad(data){
			console.log('sotryView onLoad',data)
			this.id=data.id
		},
		computed:{
			curStory(){
				return this.storys.find(story=>{
					return story.id==this.id
				})
			}
		},
		methods: {
			reveal(){
				this.revealed=!this.revealed
			}
		}
	}
</script>

<style lang='less' scoped>
	.content{
		display: flex;
		align-items: center;
		flex-direction: column;
	}
	.title{
		font-size: 50rpx;
		font-weight: bold;
		margin:30rpx;
	}
	.mian{
		text-indent:2em;
		width:700rpx;
		margin-bottom: 50rpx;
	}
	.reveal-btn{
		margin:50rpx;
	}
	.di{
		text-indent: 2em;
		width:700rpx;
	}
</style>
